#pragma once
namespace CnyeCPlus
{
	namespace util{
		public ref class Timer sealed
		{
		private protected:
			//
			double _Last;
			double _Total;
		public:
			static property double Now{
				double get(){
					Windows::Globalization::Calendar^ cct;
					cct= ref new Windows::Globalization::Calendar;
					cct->SetToNow();
					Windows::Foundation::DateTime dt=cct->GetDateTime();
					return dt.UniversalTime/10000;
				}
			}
			static property Timer^ SharedTimer{
				Timer^ get(){
					return Timer::STimer();
				}
			}
			//
			property double Last{
				double get(){
					return this->_Last;
				}
				void set(double v){
					this->_Last=v;
				}
			}
			property double Total{
				double get(){
					return this->_Total;
				}
				void set(double v){
					this->_Total=v;
				}
			}
		public:
			Timer(void);
			virtual ~Timer(void);
			void Beg(){
				this->Last=Timer::Now;
			}
			double Delay(){
				double n=Timer::Now;
				double delay=n-this->Last;
				this->Total+=delay;
				return delay;
			}
			static Timer^ STimer();
		};
	}
}
